package com.wc.alorithm_blue_bridge_history.littlewhite.Q240113.Q12117;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/1/13 19:14
 * @description 召唤神坤
 * https://www.lanqiao.cn/problems/12117/learning/?contest_id=160
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int maxN = (int) 1e5 + 7;
    static int n;
    static int[] ws = new int[maxN];
    static int[] maxQ = new int[maxN];
    static int tail = -1;
    static int head = 0;

    public static void main(String[] args) {
        n = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            ws[i] = sc.nextInt();
        }
        for (int i = 3; i <= n; i++) {
            while (tail >= 0 && maxQ[tail] < ws[i]) {
                tail--;
            }
            maxQ[++tail] = ws[i];
        }
        int preMax = ws[1];
        int ans = 0;
        for (int i = 2; i < n; i++) {
            ans = Math.max((preMax + maxQ[head]) / ws[i], ans);
            preMax = Math.max(preMax, ws[i]);
            if (ws[i + 1] == maxQ[head]) {
                head++;
            }
        }

        out.println(ans);
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }
}